// 模拟数据
import list from "./list.js";
export function getData(type) {
	return new Promise((resolute, reject) => {
		//延时一秒,模拟联网
		setTimeout(() => {
			try {
				// 模拟搜索
				let dat = []
				for (let i = 0; i < list.length; i++) {
					if (list[i].type == type) {
						dat.push(list[i])
					}
				}
				resolute(dat);
			} catch (e) {
				//模拟接口请求失败
				reject(e);
			}

		}, 1000)


	})
}
import record from "./record.js";
export function getList(type) {
	console.log("type " + type);
	return new Promise((resolute, reject) => {
		//延时一秒,模拟联网

		try {
			// 模拟搜索
			let dat = []
			if (type == 0) { //全部
				dat = record;
			} else {
				for (let i = 0; i < record.length; i++) {


					if (record[i].type == type) {
						dat.push(record[i])
					}
				}
			}

			resolute(dat);
		} catch (e) {
			//模拟接口请求失败
			reject(e);
		}

	})
}
